package com.zhangdi.demo.solr.controller.admin;

import com.mongodb.client.MongoCollection;
import com.zhangdi.demo.solr.response.Response;
import com.zhangdi.demo.solr.response.ResponseUtils;
import com.zhangdi.demo.solr.service.MongoService;
import org.bson.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by zhangdi on 2020/07/01 11:08:11.
 */
@RequestMapping("/admin")
@RestController
public class MongoController {
    @Autowired
    MongoService mongoService;

    @PostMapping("/collection/create")
    public Response createCollection(String name) {
        return mongoService.createCollection(name);
    }

    @PostMapping("/collection/drop")
    public Response dropCollection(String name) {
        return mongoService.dropCollection(name);
    }
}
